<template>
	<view class="HFC">
		<view class="HFCTop">
			<view @click="actionIndex(item.id)" :class="actionId == item.id ? 'action' : ''" v-for="item in HFCTop"
				:key="item.id">{{ item.text }}</view>
		</view>
		<view v-for="item in list[actionId].ch">
			<cardVue :footShow="true" :foot='true' :title="item.title" :extra="item.extra" @click="GeDetails(item)">
				<view style="margin: 20rpx;">
					{{ item.cont }}
				</view>
				<template v-slot:foot>
					<view class="rep-foot">
						<view class="rep-foot-item">
							<image
								src="https://cdn7.axureshop.com/demo/1996612/images/%E5%9C%A8%E7%BA%BF%E6%8A%A5%E4%BF%AE/u6981.svg">
							</image>
							<text>{{ item.iex }}</text>
						</view>
						<view class="rep-foot-item">
							<image
								src="https://cdn7.axureshop.com/demo/1996612/images/%E5%9C%A8%E7%BA%BF%E6%8A%A5%E4%BF%AE/u6982.svg">
							</image>
							<text>{{ item.xi }}</text>
						</view>
					</view>
				</template>
			</cardVue>
		</view>


		<!-- 占位 -->
		<view class="Addmt-2" @click="GeAddSuggest">
			<image src="/static/image/加号.png" mode="scaleToFill" />
		</view>
	</view>
</template>

<script setup>
import cardVue from "../../components/card.vue";
import {
	ref
} from "vue"
let HFCTop = ref([{
	id: 0,
	text: "个人保修"
},
{
	id: 1,
	text: "公共保修"
}
])
let list = ref([
	{
		ch: [
			{
				title: "漏水 ",
				id: 0,
				extra: "待处理",
				cont: '1号楼3单元2003室，发现屋顶漏水，已经淹没了厨房卫生间，物业快来修理',
				iex: "2022-02-28 12:33:15",
				xi: '花园国际小区'
			},
			{
				title: "漏水 ",
				id: 1,
				extra: "待处理",
				cont: '1号楼3单元2003室，发现屋顶漏水，已经淹没了厨房卫生间，物业快来修理',
				iex: "2022-02-28 12:33:15",
				xi: '花园国际小区'
			}
		]
	},
	{
		ch: [
			{
				title: "围挡破损",
				id: 0,
				extra: "已维修",
				cont: '北区门口围挡被破损，安全有隐患，需要物业尽快修补破损漏洞，保证业主安全。',
				iex: "2022-02-28 12:33:15",
				xi: '花园国际小区'
			},
			{
				title: "路灯损坏 ",
				id: 1,
				extra: "已维修",
				cont: '小区背面花池西边的路灯有一个月不亮了，这里挨着健身器材，小朋友们经常在这玩耍，容易引起事故，需要尽快换新。',
				iex: "2022-02-28 12:33:15",
				xi: '花园国际小区'
			}
		]

	}
])
let GeDetails = (item) => {
	if (item.extra == "待处理") {
		uni.navigateTo({
			url: "/pages/repairs/details"
		})
	}
}
let GeAddSuggest = () => {
	uni.navigateTo({
		url: "/pages/repairs/addRepairs"
	})
}
let actionId = ref(0)
// 点击高亮
let actionIndex = (id) => {
	actionId.value = id
}
</script>

<style scoped lang="scss">
.HFC {
	background-color: #f5f5f5;
	height: calc(100vh - 88rpx);
}

.HFCTop {
	height: 80rpx;
	line-height: 80rpx;
	display: flex;
	flex-direction: row;
	justify-content: space-around;

	view {
		width: 50%;
		text-align: center;
	}
}

.action {
	border-bottom: #16aef0 1rpx solid;
	color: #16aef0;
	background-color: #fff;
}

.rep-foot {
	display: flex;
	flex-direction: row;
	width: 100%;
	justify-content: space-between;

	.rep-foot-item {
		display: flex;
		flex-direction: row;
		width: 50%;
		height: 80rpx;
		align-items: center;
		justify-content: center;

		image {
			width: 40rpx;
			height: 40rpx;
		}
	}
}

.Addmt-2 {
	width: 100rpx;
	height: 100rpx;
	position: fixed;
	bottom: 100rpx;
	right: 45%;
	background-color: #fff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 0 10rpx 0 #03a7f0;

	image {
		width: 50rpx;
		height: 50rpx;
	}
}
</style>